import numpy as np
import random

data = np.genfromtxt("file_data.txt", delimiter=" ", dtype=None)
print(data)

#1.13模块编程.12package.打开文件
file = open('file_data.txt', encoding='utf-8')
print(file)
# 2.读取
text = file.read()
print(text)

# 3.关闭
file.close()

print("---------------------------------------------------------写文件--------------------------------------------------------")

op = open('open.txt','w')
op.write('hello world\n')
op.write('今天，南京的天气晴空万里\n')
op.close()

print('追加文件内容'.center(50, '-'))

# f = open('open.txt', 'w+')
# for i in range(10):
#     f.write(str(random.randint(1.13模块编程.12package,100)) + '\n')
# print(f.read())
# f.close()